﻿Public Class TakeTable_Page
    Public Sub Initialize()
        Grid1.Children.RemoveRange(0, Grid1.Children.Count)
        Dim Count As Long = HallServe.GetTableCount
        Dim i As Long, j = 1
        Dim x As Long = 0, y As Long = 2
        For i = 1 To Count
            Try
                Dim BT As New Table_Button(i, HallServe.GetTableUsed(i))
                BT.VerticalAlignment = VerticalAlignment.Top
                BT.HorizontalAlignment = HorizontalAlignment.Left
                BT.Margin = New Thickness(x, y, 0, 0)
                x += 30 + 2
                If j Mod 19 = 0 Then x = 0
                y = Fix(j / 19) * 30 + 2 * Fix(j / 19)
                Grid1.Children.Add(BT)
                j += 1
            Catch
                Continue For
            End Try
        Next
    End Sub
End Class
